package com.onesports.intelligent.k12.polarlight.controller.wx.user;

import com.onesports.intelligent.k12.polarlight.common.errors.exceptions.BusinessException;
import com.onesports.intelligent.k12.polarlight.common.utils.ResultUtil;
import com.onesports.intelligent.k12.polarlight.constant.ApiPathConstants;
import com.onesports.intelligent.k12.polarlight.domain.dto.wx.WxShareCodeDTO;
import com.onesports.intelligent.k12.polarlight.domain.dto.wx.WxShareUrlLinkDTO;
import com.onesports.intelligent.k12.polarlight.service.wx.WxShareService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;

@Api(tags = "会员端-微信分享")
@RestController
@RequiredArgsConstructor
@RequestMapping(ApiPathConstants.WX_USER_SHARE)
public class WxShareController {

    private final WxShareService wxShareService;

    @PostMapping("/generate-url-link")
    @ApiOperation(value = "获取 URL Link")
    public ResponseEntity generateUrlLink(@RequestBody WxShareUrlLinkDTO dto) throws WxErrorException {
        return ResultUtil.success("",wxShareService.generateUrlLink(dto));
    }
}
